package cn.lg.soar.cms.biz.modules.article.entity;

import cn.lg.soar.core.annotations.constraints.group.Create;
import cn.lg.soar.core.annotations.constraints.group.Update;
import cn.lg.soar.database.base.entity.BaseEntity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 文章分组
 * @author luguoxiang
 * @since 2025-02-23
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Data
@ApiModel(value = "ArticleGroup", description = "文章分组")
@TableName("lg_cms_article_group")
public class ArticleGroup extends BaseEntity {

    /**  */
    @NotNull(message = "主键不能为空", groups = { Update.class })
    @ExcelIgnore
    @ApiModelProperty(value = "主键")
    @TableId
    private Long id;

    /** 父id（0根节点） */
    @NotNull(message = "父id（0根节点）不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "父id（0根节点）")
    @ApiModelProperty(value = "父id（0根节点）")
    private Long parentId;

    /** 标题 */
    @NotBlank(message = "标题不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "标题")
    @ApiModelProperty(value = "标题")
    private String title;

    /** 封面 */
    @ExcelProperty(value = "封面")
    @ApiModelProperty(value = "封面")
    private String cover;

    /** 介绍 */
    @ExcelProperty(value = "介绍")
    @ApiModelProperty(value = "介绍")
    private String introduce;

    /** 乐观锁 */
    @NotNull(message = "乐观锁不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "乐观锁")
    @ApiModelProperty(value = "乐观锁")
    private Integer version;

    /** 内容统计数 */
    @NotNull(message = "内容统计数不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "内容统计数")
    @ApiModelProperty(value = "内容统计数")
    private Integer childCount;

    @JsonIgnore
    @Override
    public Long primaryKey() {
        return this.id;
    }

}
